// 利用闭包，在初始化的时候将重复部分，封装起来。基于面向对象，实现对象的封装。

function makePower(power) {
  return function (number) {
    return Math.pow(number, power)
  }
}

// 求平方
let power2 = makePower(2)
let power3 = makePower(3)

console.log(power2(4))
console.log(power2(5))
console.log(power3(4))

// 算工资
function makeSalary(base) {
  return function (performance) {
    return base + performance
  }
}


let salaryLevel1 = makeSalary(12000)
let salaryLevel2 = makeSalary(15000)


console.log(salaryLevel1(2000))
console.log(salaryLevel2(3000))